package com.njitt.demo.controller;

import com.njitt.demo.pojo.Student;
import com.njitt.demo.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController

/**
 *解决跨域问题
 */
@CrossOrigin(origins = "*")

@RequestMapping(value = "/test")
public class StudentController {
    @Autowired
    private StudentService studentService;

    @RequestMapping(value = "/queryStudentList",method = RequestMethod.GET)
    public List<Student> queryStudentList(){
        List<Student> student = studentService.queryStudentList();
        System.out.println("queryStudentList方法被调用");
        return student;
    }

    /**
     *


    @RequestMapping(value = "/selectStudentByid", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    public String GetStudent(Student student){
        return studentService.Sel(student).toString();
    }

    @RequestMapping(value = "/add", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    public String Add(Student student){
        return studentService.Add(student);
    }

    @RequestMapping(value = "/delete", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    public String Delete(Student student){
        return studentService.Delete(student);
    }

     */
}
